#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
int d[N];
void solve()
{
    ll n;
    cin >> n;
    for (ll i = 1; i <= n;i++)
    {
        ll x;
        cin >> x;
        d[x]++;
    }
    vector<int> ans;
    for (ll i = 1; i <= n;i++)
    {
        if(d[i]==0)
        {
            cout << -1 << endl;
            return;
        }
        if(d[i]==1)
        {
            ans.push_back(d[i]);
        }
    }
    if(ans.size()!=2)
    {
        cout << -1 << endl;
    }
    else {
        cout << ans[0] << " " << ans[1] << endl;
    }
}
int main()
{
    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}